home *** CD-ROM | disk | FTP | other *** search
/ SVM Mac 71 / CD-ROM N°71.iso / modelaliser / models / mla003.swf / scripts / DefineSprite_208 / frame_1 / DoAction.as
Encoding:
Text File  |  2001-07-11  |  3.1 KB  |  156 lines

  1. function loadVR(imagesSWF)
  2. {
  3.    images.loadMovie(imagesSWF);
  4. }
  5. function actionVR(action, param)
  6. {
  7.    if(action == "poseSuivante")
  8.    {
  9.       poseSuivante();
  10.    }
  11.    else if(action == "posePrecedente")
  12.    {
  13.       posePrecedente();
  14.    }
  15.    else if(action == "angleSuivant")
  16.    {
  17.       angleSuivant();
  18.    }
  19.    else if(action == "anglePrecedent")
  20.    {
  21.       anglePrecedent();
  22.    }
  23.    else if(action == "startLectureAvant")
  24.    {
  25.       gotoAndStop(2);
  26.    }
  27.    else if(action == "startLectureArriere")
  28.    {
  29.       gotoAndStop(3);
  30.    }
  31.    else if(action == "afficherGrille")
  32.    {
  33.       grilles.gotoAndStop(param + 1);
  34.    }
  35.    else if(action == "effacerGrille")
  36.    {
  37.       grilles.gotoAndStop(1);
  38.    }
  39.    else if(action == "startZoomIn")
  40.    {
  41.       gotoAndStop(4);
  42.    }
  43.    else if(action == "startZoomOut")
  44.    {
  45.       gotoAndStop(5);
  46.    }
  47.    else if(action == "startMove")
  48.    {
  49.       gotoAndStop(6);
  50.    }
  51.    else if(action == "reset")
  52.    {
  53.       reset();
  54.    }
  55.    else
  56.    {
  57.       gotoAndStop(1);
  58.       images.gotoAndStop(_root.imageCourante);
  59.       zoneDrag.stopDrag();
  60.       barre.btMove.gotoAndStop(1);
  61.    }
  62. }
  63. function poseSuivante()
  64. {
  65.    if(1 < images._currentFrame % 30)
  66.    {
  67.       images.prevFrame();
  68.    }
  69.    else
  70.    {
  71.       images.gotoAndStop(Math.floor(images._currentFrame / 30) * 30 + 24);
  72.    }
  73.    _root.imageCourante = images._currentFrame;
  74. }
  75. function posePrecedente()
  76. {
  77.    if(images._currentFrame % 30 < 24)
  78.    {
  79.       images.nextFrame();
  80.    }
  81.    else
  82.    {
  83.       images.gotoAndStop(Math.floor(images._currentFrame / 30) * 30 + 1);
  84.    }
  85.    _root.imageCourante = images._currentFrame;
  86. }
  87. function angleSuivant()
  88. {
  89.    if(images._currentFrame < 60)
  90.    {
  91.       images.gotoAndStop(images._currentFrame + 30);
  92.    }
  93.    _root.imageCourante = images._currentFrame;
  94. }
  95. function anglePrecedent()
  96. {
  97.    if(30 < images._currentFrame)
  98.    {
  99.       images.gotoAndStop(images._currentFrame - 30);
  100.    }
  101.    _root.imageCourante = images._currentFrame;
  102. }
  103. function zoomIn()
  104. {
  105.    if(images._xscale < 10000)
  106.    {
  107.       images._xscale += 20;
  108.       images._yscale += 20;
  109.    }
  110.    zoneDrag._width = images._width - 560;
  111.    zoneDrag._height = images._height - 560;
  112. }
  113. function zoomOut()
  114. {
  115.    if(100 < images._xscale)
  116.    {
  117.       images._xscale -= 20;
  118.       images._yscale -= 20;
  119.       zoneDrag._width = images._width - 560;
  120.       zoneDrag._height = images._height - 560;
  121.       l = Math.ceil(zoneDrag._x - zoneDrag._width / 2);
  122.       t = Math.ceil(zoneDrag._y - zoneDrag._height / 2);
  123.       r = l + zoneDrag._width;
  124.       b = t + zoneDrag._height;
  125.       if(images._x < l)
  126.       {
  127.          images._x = l + 1;
  128.       }
  129.       else if(r < images._x)
  130.       {
  131.          images._x = r - 1;
  132.       }
  133.       if(images._y < t)
  134.       {
  135.          images._y = t + 1;
  136.       }
  137.       else if(b < images._y)
  138.       {
  139.          images._y = b - 1;
  140.       }
  141.    }
  142. }
  143. function reset()
  144. {
  145.    images._xscale = 100;
  146.    images._yscale = 100;
  147.    images._x = 280;
  148.    images._y = 280;
  149.    zoneDrag._width = 1;
  150.    zoneDrag._height = 1;
  151.    actionVR("endMove");
  152.    images.gotoAndStop(1);
  153.    _root.imageCourante = 1;
  154. }
  155. stop();
  156.